import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import {AppComponent} from './app.component';

import {TopnavComponent} from './topnav/topnav.component';
import {NavsideComponent} from './navside/navside.component';
import {ContentComponent} from './content/content.component';

import {LoginComponent} from './login/login.component';
import {ModulListComponent} from './modul-list/modul-list.component';
import {AuthGuard} from './auth_guard.service';
import {ErrorpageComponent} from './errorpage/errorpage.component';

import { PalyLogComponent } from './paly-log/paly-log.component';
import { PalyRequestComponent } from './paly-request/paly-request.component';
import { PlatformComponent } from './platform/platform.component';
import { StationComponent } from './station/station.component';
import { AcceptorComponent } from './acceptor/acceptor.component';
import { PlaySystemComponent } from './play-system/play-system.component';
import { TerminalInfoComponent } from './terminal-info/terminal-info.component';
import { PlaysystemComponent } from './playsystem/playsystem.component';

import { StationlogComponent } from './stationlog/stationlog.component';
import { AcceptorLogComponent } from './acceptor-log/acceptor-log.component';
import { PlaySystemLogComponent } from './play-system-log/play-system-log.component';
import { PlatformLogComponent } from './platform-log/platform-log.component';
import { TerminalLogComponent } from './terminal-log/terminal-log.component';




const childRoutes: Routes = [

 { path: '', component: PalyRequestComponent },
  {path: 'playLog', component: PalyLogComponent},
  {path: 'playRequest', component: PalyRequestComponent},
  {path: 'platform', component: PlatformComponent},
  {path: 'operationInfo', component: StationComponent},
  {path: 'station', component: StationComponent},
  {path: 'acceptor', component: AcceptorComponent},
  {path: 'playSystem', component: PlaySystemComponent},
  {path: 'terminalInfo', component: TerminalInfoComponent},
  {path: 'playsys', component: PlaysystemComponent},
  {path: 'omdLog', component: StationlogComponent},
  {path: 'acceptorlog', component: AcceptorLogComponent},
  {path: 'playSystemlog', component: PlaySystemLogComponent},
  {path: 'terminalInfolog', component: TerminalLogComponent},
  {path: 'playsyslog', component: PlaySystemLogComponent},
  {path: 'platformlog', component: PlatformLogComponent},
  { path: 'errorpage', component: ErrorpageComponent},



]



const routes: Routes = [

  { path: 'login', component: LoginComponent},
  { path: '',  component: ModulListComponent ,
    canActivate: [AuthGuard],
    children: childRoutes },

  { path: '**', component: ErrorpageComponent }


];
@NgModule({
  imports: [ RouterModule.forRoot(routes) ],
  exports: [ RouterModule ],
  providers: [ AuthGuard ]
})
export class AppRoutingModule {}
